<%@ page language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>返利-统计</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <jsp:include page="../com/header.jsp"></jsp:include>
    <script type="text/javascript" src="../../js/comm/listcomm.js"></script>
    <script type="text/javascript">
        var contentUrl      = root + "cms/fanliOrder/findStatisticsByYear";
        var fanliBusListUrl = root + "cms/fanliBusiness/findFanliBusinessNEStatusPage";
        function getfilter() {
            var _jsonFilter = "{";
            if ($("#busId").val() && $("#busId").val().length > 0) {
                _jsonFilter += "'search_EQ_busId':'" + $("#busId").val().replace("'", "\"") + "',";
            }
            if ($("#search_year").val() && $("#search_year").val().length > 0) {
                _jsonFilter += "'search_EQ_year':'" + $("#search_year").val().replace("'", "\"") + "',";
            }
            if (_jsonFilter != "{") {
                _jsonFilter = _jsonFilter.substring(0, _jsonFilter.length - 1);
            }
            _jsonFilter += "}";
            return _jsonFilter;
        }
        
        $(document).ready(function () {
            //加载返利商家
            getFanliBusinessList();
        });

        //加载返利商家
        function getFanliBusinessList() {
            $.ajax({
                url: fanliBusListUrl,
                data: {
                    nextPage: 0,
                    pageSize: 99999,
                    sortData: null,
                    jsonFilter:null
                },
                type: 'POST',
                timeout: 7000,
                dataType: 'json'
            }).done(function (data) {
                if (data.code == 1) {
                    var _html = "<option value='' selected>请选择</option>";
                    for (var i = 0; i < data.object.content.length; i++) {
                        _html += "<option value='" + data.object.content[i].id + "'>" + data.object.content[i].businessName + "</option>";
                    }
                    $('#busId').html(_html);
                } else {
                    myAlert(data.message || tipMessage.undefined_msg);
                }
            }).fail(function (jqXHR, textStatus, errorThrown) {
                if (textStatus == "timeout") {
                    myAlert(tipMessage.timeout_msg || "请求超时");
                } else {
                    myAlert(tipMessage.error_msg);
                }
            });
        }
    </script>
</head>
<body>
<section>
    <div>
        <div class="col-xs-12">
            <div class="box">
                <form id="search_form" class="form-horizontal">
                    <div class="tabSelect" id="selectHeadId">
                        <br>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls" for="">商家：</label>
                            <div class="col-md-8">
                                <select name="search_busId" id="busId"
                                        class="form-control input-sm"></select>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">年份：</label>
                            <div class="col-md-8" style="padding-right:0;position:relative;">
                                <div class="datetime_clear"></div>
                                <input type="text" placeholder="年份" readOnly=""
                                       class="form-control input-sm" id="search_year" name="year">
                            </div>
                        </div>
                        <input type="button" value="查询" id="search" class="btn btn-primary searchBtn">
                    </div>
                </form>
                <div class="box-body table-responsive" style="clear:both;height: 20px">
                </div>
                <div class="box-body table-responsive">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="30"><input type="checkbox" id="_selectAll"/></th>
                            <th width="80">商家</th>
                            <th width="80">月份</th>
                            <th width="80">本月平台返利收入</th>
                        </tr>
                        </thead>
                        <!-- 表格内容 start -->
                        <tbody id="mycontent"></tbody>
                        <!-- 表格内容 end -->
                    </table>
                    <!-- 分页标签 start -->
                    <div class="row page_big_div" id="displayPage"></div>
                    <!-- 分页标签 end -->
                    <script id="tableContentTmple" type="text/x-jsrender">
								<tr>
									<td><input id="ck_{{:id}}" ckId="{{:id}}" ckStatus="{{:status}}" ckBusId="{{:busId}}" class="ckSelect" type="checkbox" /></td>
									<td>{{:businessName}}</td>
									<td>{{toThousands:money}}</td>
									<td>{{:monthFanliMoney}}</td>
								</tr>

                    </script>
                </div>
            </div>
        </div>
</section>
</body>
</html>